use strict;
use warnings;

package JasPerl::Compiler::FunctionMapper;
use base qw{ JasPerl::EL::FunctionMapper };

sub new {
    my ($class, $taglibs) = @_;
    bless { taglibs => $taglibs }, $class;
}

sub modules {
    return keys %{$_[0]->{modules}};
}

sub resolve_function {
    no strict 'refs';
    my ($self, $prefix, $name) = @_;
    my $taglib = $self->{taglibs}->{$prefix} or return;
    print "*** TAGLIB $prefix: $taglib\n";
    my $fn = *{"${taglib}::${name}"}; #$taglib->function($name) or return;
    print "*** FN $name: $fn\n";
    $self->{modules}->{*{$fn}{PACKAGE}}++;
    return $fn;
}

1;
